home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / program / misc / m2pica.lha / M2Pica / Txt / Space.mod < prev    next >
Text File  |  1995-08-21  |  15KB  |  622 lines

  1. (*******************************************************************************
  2.  : Program.         Space.mod
  3.  : Author.          Carsten Wartmann (Crazy Video)
  4.  : Address.         Wutzkyallee 83, 12353 Berlin
  5.  : Phone.           030/6614776
  6.  : E-Mail           C.Wartmann@GANDALF.berlinet.de (bevorzugt)
  7.  : E-Mail           Carsten_Wartmann@tfh-berlin.de
  8.  : Version.         0.5
  9.  : Date.            16.Aug.1994
  10.  : Copyright.       PD
  11.  : Language.        Modula-2
  12.  : Compiler.        M2Amiga V4.3
  13.  : Contents.        Animaniton / Einlesen / Scaling von BMP .
  14. *******************************************************************************)
  15.  
  16. (*$ LargeVars := FALSE*)
  17. (*$StackParms := FALSE*)
  18.  
  19. MODULE Space ;
  20.  
  21.  
  22. FROM SYSTEM       IMPORT ADR,ADDRESS,TAG,BITSET,SHIFT,ASSEMBLE ;
  23.  
  24. FROM UtilityD     IMPORT tagEnd,tagDone ;
  25.  
  26. FROM Arts         IMPORT Assert ;
  27.  
  28. FROM ExecL        IMPORT Forbid,Permit,AllocMem,FreeMem,CopyMem ;
  29. FROM ExecD        IMPORT MemReqs,MemReqSet ;
  30.  
  31. FROM DosL         IMPORT Delay ;
  32.  
  33. FROM GraphicsL    IMPORT SetRGB4 ;
  34.  
  35. FROM IntuitionD   IMPORT ScreenPtr ;
  36. FROM IntuitionL   IMPORT ScreenToFront ;
  37.  
  38. FROM RandomNumber IMPORT RND ;
  39.  
  40. FROM VilIntuiSupL IMPORT OpenVillageScreenTagList,CloseVillageScreen,
  41.                          LockVillageScreen,UnLockVillageScreen,
  42.                          VillageRectFill,VillageBlitCopy,WaitVillageBlit,
  43.                          VillageModeRequest,VillageSetDisplayBuf,VillageGetBufAddr ;
  44. FROM VilIntuiSupD IMPORT SetPackedPixel,LinePacked,ClearScreen,ClearBuf,
  45.                          VilFillRecord,VilCopyRecord,VilScrCopy,VilScrAnd,
  46.                          VilDstInvert,VilScrPaint,TavisTags,InvalidID ;
  47.  
  48. FROM FileSystem   IMPORT Lookup,File,Close,ReadChar,done,ReadBytes,SetPos ;
  49.  
  50. FROM InOut        IMPORT WriteInt,WriteLn,WriteString,Write,WriteCard,WriteHex ;
  51.  
  52. FROM String       IMPORT Compare ;
  53.  
  54. FROM Break        IMPORT InstallException ;
  55.  
  56. FROM Timer2       IMPORT StartTime,StopTime,TimeVal ;
  57.  
  58. IMPORT R ;
  59.  
  60.  
  61.  
  62. CONST Bildname = "pics/Space1.bmp" ;
  63.       Bildw    = 640 ;
  64.       Bildh    = 512 ;
  65.  
  66.       Cookie   = "pics/Kugeln1.bmp" ;
  67.       Cookiew  =  16 ;
  68.       Cookieh  =  240 ;
  69.  
  70.       Objekte  = 20 ;
  71.  
  72.  
  73. TYPE AObjekt = RECORD
  74.        x,y,
  75.        vx,vy,
  76.        as,frm : INTEGER ;
  77.        xa,ya  : ARRAY [0..1] OF INTEGER ;
  78.        adr    : ADDRESS ;
  79.        w,h,
  80.        cnt    : INTEGER ;
  81.      END ;
  82.  
  83.      LONGPTR = POINTER TO LONGCARD ;
  84.  
  85.  
  86.  
  87. VAR cia[0BFE000H]  : BITSET ;
  88.     Joy1[0DFF00CH] : BITSET ;
  89.  
  90.     time      : TimeVal ;
  91.     tags      : ARRAY [0..40] OF LONGCARD ;
  92.     bufadr    : ARRAY [0..1] OF ADDRESS ;
  93.  
  94.     scr       : ScreenPtr ;
  95.  
  96.     start,
  97.     source,
  98.     kugeln,
  99.     ufo,
  100.     expl      : ADDRESS ;
  101.     aobj      : ARRAY [0..Objekte-1] OF AObjekt ;
  102.  
  103.     col,buf,
  104.     buf1,
  105.     i,j       : LONGINT ;
  106.     mode      : LONGCARD ;
  107.     tc        : SHORTCARD ;
  108.     x,y,ok,
  109.     xmit,ymit,
  110.     xoff,yoff : LONGINT ;
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. PROCEDURE Rechts() : BOOLEAN ;
  119.    BEGIN
  120.       RETURN (1 IN Joy1) ;
  121. END Rechts ;
  122.  
  123. PROCEDURE Links() : BOOLEAN ;
  124.    BEGIN
  125.       RETURN (9 IN Joy1) ;
  126. END Links ;
  127.  
  128. PROCEDURE XOR(a,b : BOOLEAN) : BOOLEAN ;
  129.    BEGIN
  130.       RETURN ((a OR b) AND NOT (a AND b)) ;
  131. END XOR ;
  132.  
  133. PROCEDURE Unten() : BOOLEAN ;
  134.    BEGIN
  135.       RETURN XOR(Rechts(),(0 IN Joy1)) ;
  136. END Unten ;
  137.  
  138. PROCEDURE Oben() : BOOLEAN ;
  139.    BEGIN
  140.       RETURN XOR(Links(),(8 IN Joy1)) ;
  141. END Oben ;
  142.  
  143.  
  144. PROCEDURE WaitMaus(delay : INTEGER) ;
  145. BEGIN
  146.   WHILE (6 IN cia) DO
  147.   END ;
  148.   Delay(delay) ;
  149. END WaitMaus ;
  150.  
  151.  
  152. PROCEDURE Erg(elap : TimeVal) ;
  153.   BEGIN
  154.     WriteLn ;
  155.     WriteString("Ergebnis : ") ;
  156.     WriteInt(elap.secs,6) ;
  157.     WriteInt(elap.micro,10) ;
  158.     WriteLn ;
  159.   END Erg ;
  160.  
  161.  
  162. (* Bringt BMP direkt auf den Bildschirm *)
  163. PROCEDURE ReadBMPS(name : ARRAY OF CHAR ; scr : ScreenPtr ; w,h : LONGCARD) ;
  164. VAR f     : File ;
  165.     act,i : LONGINT ;
  166.     start : ADDRESS ;
  167.  
  168.  
  169.   BEGIN
  170.     Lookup(f,name,40000,FALSE) ;
  171.     Assert(f.res=done,ADR("Kann File nicht öffnen !")) ;
  172.     start := LockVillageScreen(scr) ;
  173.  
  174.     SetPos(f,1078) ;
  175.     INC(start,LONGCARD(scr^.width)*(h-1)) ;
  176.     FOR y:=1 TO h DO
  177.       ReadBytes(f,start,w,act) ;
  178.       DEC(start,scr^.width) ;
  179.     END ;
  180.  
  181.     UnLockVillageScreen(scr) ;
  182.     Close(f) ;
  183.   END ReadBMPS ;
  184.  
  185.  
  186. (* Liest BMP in einen Speicherbereich *)
  187. PROCEDURE ReadBMP(name : ARRAY OF CHAR ; w,h : LONGCARD) : ADDRESS ;
  188. VAR f     : File ;
  189.     act,i : LONGINT ;
  190.     start,
  191.     cnt   : ADDRESS ;
  192.  
  193.   BEGIN
  194.     start := AllocMem(w*h,MemReqSet{fast}) ;
  195.     Assert(start#NIL,ADR("Kein Speicher !")) ;
  196.  
  197.     Lookup(f,name,40000,FALSE) ;
  198.     Assert(f.res=done,ADR("Kann File nicht öffnen !")) ;
  199.  
  200. (* Warum stehen BMP-Bilder auf dem Kopf ?
  201.     SetPos(f,1078) ;
  202.     ReadBytes(f,start,w*h,act) ;
  203.     IF (act<LONGINT(w*h)) THEN
  204.       Close(f) ;
  205.       Assert(FALSE,ADR("Fehler beim Bildlesen (w*h?) !")) ;
  206.     END ;
  207. *)
  208.     cnt := start ;
  209.     SetPos(f,1078) ;
  210.     INC(cnt,w*(h-1)) ;
  211.     FOR y:=1 TO h DO
  212.       ReadBytes(f,cnt,w,act) ;
  213.       DEC(cnt,w) ;
  214.     END ;
  215.  
  216.     Close(f) ;
  217.     RETURN(start) ;
  218.  
  219.   END ReadBMP ;
  220.  
  221. (* Extrahiert die Palette eines BMP *)
  222. PROCEDURE ReadPAL(name : ARRAY OF CHAR ; scr : ScreenPtr) ;
  223. VAR f     : File ;
  224.     act,i : LONGINT ;
  225.     r,g,b,
  226.     s     : SHORTCARD ;
  227.  
  228.   BEGIN
  229.     Lookup(f,name,10000,FALSE) ;
  230.     Assert(f.res=done,ADR("Kann File nicht öffnen !")) ;
  231.  
  232.     SetPos(f,54) ;
  233.     FOR col:=0 TO 255 DO
  234.       ReadBytes(f,ADR(b),1,act) ;
  235.       ReadBytes(f,ADR(g),1,act) ;
  236.       ReadBytes(f,ADR(r),1,act) ;
  237.       ReadBytes(f,ADR(s),1,act) ;
  238.       SetRGB4(ADR(scr^.viewPort),col,r,g,b) ;
  239.     END ;
  240.  
  241.     Close(f) ;
  242.   END ReadPAL ;
  243.  
  244.  
  245.  
  246. (* Skaliert auf Screen *)
  247. PROCEDURE ScaleS(scr : ScreenPtr ; xs,ys,w,h,xd,yd,faktor : LONGINT) ;
  248. VAR x,y,
  249.     xx,yy : LONGINT ;
  250.     dst,
  251.     srt   : ADDRESS ;
  252.  
  253.   BEGIN
  254.     start := LockVillageScreen(scr) ;
  255.  
  256.     srt := (LONGINT(start)+xs+ys*LONGINT(scr^.width)) ;
  257.     dst := (LONGINT(start)+xd+yd*LONGINT(scr^.width)) ;
  258.  
  259.     y:=10 ;
  260.     WHILE (y<=h*10) DO
  261.       x:=0 ;
  262.       WHILE (x<w*10) DO
  263.         xx := x DIV 16 ;
  264.         ADDRESS(LONGINT(dst)+x DIV faktor)^ := ADDRESS(LONGINT(srt)+xx)^ ;
  265.         INC(x,faktor) ;
  266.       END ;
  267.       yy := y DIV 10 ;
  268.       srt := ADDRESS(LONGINT(start)+LONGINT(scr^.width)*yy) ;
  269.       INC(dst,scr^.width) ;
  270.       INC(y,faktor) ;
  271.     END ;
  272.     UnLockVillageScreen(scr) ;
  273.  
  274.   END ScaleS ;
  275.  
  276. (*Skaliert Bild aus Speicher auf Screen hoch/runter *)
  277. (*Doch noch xs/ys angeben....*)
  278. PROCEDURE Scale(source : ADDRESS ; scr : ScreenPtr ; w,h,xd,yd,faktor : LONGINT) ;
  279. VAR x,y,
  280.     xx,yy   : LONGINT ;
  281.     dst,srt : ADDRESS ;
  282.  
  283.   BEGIN
  284.     start := LockVillageScreen(scr) ;
  285.  
  286.     dst := (LONGINT(start)+xd+yd*LONGINT(scr^.width)) ;
  287.     srt := source ;
  288.  
  289.     y:=16 ;
  290.     WHILE (y<=SHIFT(h,4)) DO
  291.       x:=0 ;
  292.       WHILE (x<SHIFT(w,4)) DO
  293.         xx := SHIFT(x,-4) ;
  294.         ADDRESS(LONGINT(dst)+x DIV faktor)^ := ADDRESS(LONGINT(srt)+xx)^ ;
  295.         INC(x,faktor) ;
  296.       END ;
  297.       srt := ADDRESS(LONGINT(source)+w*SHIFT(y,-4)) ;
  298.       INC(dst,scr^.width) ;
  299.       INC(y,faktor) ;
  300.     END ;
  301.     UnLockVillageScreen(scr) ;
  302.  
  303.   END Scale ;
  304.  
  305.  
  306. (*Skaliert Bild aus Speicher auf Dest hoch/runter *)
  307. (*Doch noch xs/ys angeben....*)
  308. (*$StackChk := FALSE *)
  309. (*$RangeChk := FALSE *)
  310. (*$OverflowChk := FALSE *)
  311. (*$NilChk := FALSE *)
  312. (*$EntryClear := FALSE *)
  313. (*$CaseChk := FALSE *)
  314. (*$ReturnChk := FALSE *)
  315. PROCEDURE ScaleM(scr : ScreenPtr ; source : ADDRESS ; dest : ADDRESS ;
  316.                  w{R.D2},h,xd,yd,faktor{R.D0} : LONGINT) ;
  317. VAR x{R.D3},
  318.     xs{R.D5},
  319.     sw{R.D1}   : LONGINT ;
  320.     y{R.D4}    : LONGINT ;
  321.     dst{R.A1},
  322.     srt{R.A0}  : ADDRESS ;
  323.  
  324.   BEGIN
  325.     sw := scr^.width ;
  326.     y  := 16 ;
  327.     xs := SHIFT(w,4) ;
  328.     dst := (LONGINT(dest)+xd+yd*sw) ;
  329.     srt := source ;
  330.  
  331.     WaitVillageBlit ;
  332.  
  333.     WHILE (y<=SHIFT(h,4)) DO
  334.       x:=0 ;
  335.       WHILE (x<xs) DO
  336.         ADDRESS(dst+ADDRESS(x DIV faktor))^ := ADDRESS(srt+ADDRESS(SHIFT(x,-4)))^ ;
  337.         INC(x,faktor) ;
  338.       END ;
  339.       srt := source+ADDRESS(w*SHIFT(y,-4)) ;
  340.       INC(dst,sw) ;
  341.       INC(y,faktor) ;
  342.     END ;
  343.  
  344.   END ScaleM ;
  345.  
  346.  
  347.  
  348. (*$StackChk := FALSE *)
  349. (*$RangeChk := FALSE *)
  350. (*$OverflowChk := FALSE *)
  351. (*$NilChk := FALSE *)
  352. (*$EntryClear := FALSE *)
  353. (*$CaseChk := FALSE *)
  354. (*$ReturnChk := FALSE *)
  355. PROCEDURE CookieCut(scr : ScreenPtr ; source{R.A0} : ADDRESS ;
  356.                                       dest{R.A1}   : ADDRESS ;
  357.                                       w{R.D5},h{R.D7},xd,yd : LONGINT ;
  358.                                       trans{R.D3} : SHORTCARD) ;
  359. VAR x{R.D0},y{R.D1},sw{R.D2}   : LONGINT ;
  360.  
  361.   BEGIN
  362.     sw := scr^.width ;
  363.     INC(dest,xd) ;
  364.     INC(dest,sw*yd) ;
  365.     sw:=sw-w ;
  366.     FOR y:=1 TO h DO
  367.       FOR x:=1 TO w DO
  368.         IF SHORTCARD(source^)#trans THEN
  369.           dest^ := source^ ;
  370.         END ;
  371.         INC(dest,1) ;
  372.         INC(source,1) ;
  373.       END ;
  374.       INC(dest,sw) ;
  375.     END ;
  376.  
  377.   END CookieCut ;
  378.  
  379.  
  380. PROCEDURE SaveBack(scr : ScreenPtr ; source : ADDRESS ;
  381.                                      dest   : ADDRESS ;
  382.                                      w,h,xd,yd : LONGINT) ;
  383. VAR x,y,sw   : LONGINT ;
  384.     dst{R.A1},
  385.     srt{R.A0}  : ADDRESS ;
  386.  
  387.   BEGIN
  388.     sw := scr^.width ;
  389.     INC(source,xd) ;
  390.     INC(source,sw*yd) ;
  391.     WaitVillageBlit ;
  392.     FOR y:=1 TO h DO
  393.       FOR x:=1 TO w DO
  394.           dest^ := source^ ;
  395.         INC(dest,1) ;
  396.         INC(source,1) ;
  397.       END ;
  398.       INC(source,sw-w) ;
  399.     END ;
  400.  
  401.   END SaveBack ;
  402.  
  403.  
  404. PROCEDURE RestBack(scr : ScreenPtr ; source : ADDRESS ;
  405.                                      dest   : ADDRESS ;
  406.                                      w,h,xd,yd : LONGINT) ;
  407. VAR x,y,sw   : LONGINT ;
  408.     dst{R.A1},
  409.     srt{R.A0}  : ADDRESS ;
  410.  
  411.   BEGIN
  412.     sw := scr^.width ;
  413.     INC(dest,xd) ;
  414.     INC(dest,sw*yd) ;
  415.     WaitVillageBlit ;
  416.     FOR y:=1 TO h DO
  417.       FOR x:=1 TO w DO
  418.           dest^ := source^ ;
  419.         INC(dest,1) ;
  420.         INC(source,1) ;
  421.       END ;
  422.       INC(dest,sw-w) ;
  423.     END ;
  424.  
  425.   END RestBack ;
  426.  
  427.  
  428. (*$StackChk := FALSE *)
  429. (*$RangeChk := FALSE *)
  430. (*$OverflowChk := FALSE *)
  431. (*$NilChk := FALSE *)
  432. (*$EntryClear := FALSE *)
  433. (*$CaseChk := FALSE *)
  434. (*$ReturnChk := FALSE *)
  435. PROCEDURE Restore(scr : ScreenPtr ; source{R.A0} : LONGPTR ;
  436.                                     dest{R.A1}   : LONGPTR ;
  437.                                     w{R.D3},h{R.D4},xd,yd : LONGINT) ;
  438. VAR x{R.D0},y{R.D1},sw{R.D2}   : LONGINT ;
  439.  
  440.   BEGIN
  441.     sw := scr^.width ;
  442.     INC(dest,xd) ;
  443.     INC(dest,sw*yd) ;
  444.     INC(source,xd) ;
  445.     INC(source,sw*yd) ;
  446.     sw:=sw-w ;
  447.     FOR y:=1 TO h DO
  448.       FOR x:=1 TO SHIFT(w,-2) DO
  449.         dest^ := source^ ;
  450.         INC(dest,4) ;
  451.         INC(source,4) ;
  452.       END ;
  453.       INC(dest,sw) ;
  454.       INC(source,sw) ;
  455.     END ;
  456.  
  457.   END Restore ;
  458.  
  459.  
  460.  
  461. PROCEDURE Swap(VAR a{R.A0},b{R.A1} : LONGINT) ;
  462. VAR temp{R.D0} : LONGINT ;
  463.   BEGIN
  464.     temp:=a ; a:=b; b:=temp ;
  465.   END Swap ;
  466.  
  467.  
  468.  
  469. BEGIN
  470.   InstallException ;
  471.  
  472. (*
  473.   mode := VillageModeRequest(TAG(tags,tavisMinDepth,    8,
  474.                                       tavisMaxDepth,    8,
  475.                                       tavisMinHeight, 256,
  476.                                            tagDone)) ;
  477.   Assert(mode#InvalidID,ADR("Kein Screenmode gewählt !")) ;
  478. *)
  479.   scr := OpenVillageScreenTagList(TAG(tags,tavisScreenWidth,  640,
  480.                                            tavisScreenHeight, 512,
  481.                                            tavisScreenDepth,    8,
  482.                                            tavisDoubleBuffer,   2,
  483.                                            tagDone)) ;
  484.   Assert(scr#NIL,ADR("Kann PICASSO Screen nicht öffnen !")) ;
  485.  
  486.   start := LockVillageScreen(scr) ;
  487.   FOR buf:=0 TO 1 DO
  488.     bufadr[buf] := VillageGetBufAddr(scr,buf) ;
  489.   END ;
  490.  
  491.   xmit := scr^.width  DIV 2 ;
  492.   ymit := scr^.height DIV 4 ;   (* wg. DoubleBuffer !!!!!!! *)
  493.   xoff := Bildw * 8 ;
  494.   yoff := Bildh * 8 ;
  495.  
  496.   UnLockVillageScreen(scr) ;
  497.  
  498.   ReadPAL(Bildname,scr) ;
  499.   source := ReadBMP(Bildname,Bildw,Bildh) ;
  500.  
  501.  
  502.   kugeln := ReadBMP("pics/Kugeln1.bmp",16,16*15) ;
  503.   ufo    := ReadBMP("pics/Ufo.bmp",32,33*8) ;
  504.   expl   := ReadBMP("pics/Explosion.bmp",16,16*4) ;
  505.  
  506.  
  507.   FOR i:=0 TO 6 DO
  508.     aobj[i].adr := ufo ;
  509.     aobj[i].x   := RND(scr^.width-100)+50 ;
  510.     aobj[i].y   := RND((scr^.height DIV 2)-100)+50 ;
  511.     aobj[i].vx  := RND(8)+1 ;
  512.     aobj[i].vy  := 0 ; (*RND(8)+1 ;*)
  513.     aobj[i].frm := RND(aobj[i].cnt) ;
  514.     aobj[i].as  :=  1 ;
  515.     aobj[i].w   := 32 ;
  516.     aobj[i].h   := 33 ;
  517.     aobj[i].cnt := 8 ;
  518.   END ;
  519.  
  520.   FOR i:=6 TO 15 DO
  521.     aobj[i].adr := kugeln ;
  522.     aobj[i].x   := RND(scr^.width-100)+50 ;
  523.     aobj[i].y   := RND((scr^.height DIV 2)-100)+50 ;
  524.     aobj[i].vx  := RND(8)+1 ;
  525.     aobj[i].vy  := RND(8)+1 ;
  526.     aobj[i].frm := RND(aobj[i].cnt) ;
  527.     aobj[i].as  :=  1 ;
  528.     aobj[i].w   := 16 ;
  529.     aobj[i].h   := 16 ;
  530.     aobj[i].cnt := 15 ;
  531.   END ;
  532.  
  533.   FOR i:=15 TO Objekte-1 DO
  534.     aobj[i].adr := expl ;
  535.     aobj[i].x   := RND(scr^.width-100)+50 ;
  536.     aobj[i].y   := RND((scr^.height DIV 2)-100)+50 ;
  537.     aobj[i].vx  := RND(8)+1 ;
  538.     aobj[i].vy  := RND(8)+1 ;
  539.     aobj[i].frm := RND(aobj[i].cnt) ;
  540.     aobj[i].as  :=  1 ;
  541.     aobj[i].w   := 16 ;
  542.     aobj[i].h   := 16 ;
  543.     aobj[i].cnt :=  4 ;
  544.   END ;
  545.  
  546.   buf := 0 ;
  547.   VillageSetDisplayBuf(scr,buf) ;
  548.   ClearBuf(scr,bufadr[buf]) ;
  549.   WaitVillageBlit ;
  550.   CopyMem(source,bufadr[buf],Bildw*Bildh) ;
  551.   buf := 1 ;
  552.   VillageSetDisplayBuf(scr,buf) ;
  553.   ClearBuf(scr,bufadr[buf]) ;
  554.   WaitVillageBlit ;
  555.   CopyMem(source,bufadr[buf],Bildw*Bildh) ;
  556.  
  557.   buf  := 0 ;  (* ToDo : Gleich die BuffAdr tauschen... ???*)
  558.   buf1 := 1 ;
  559.  
  560.   Forbid() ;
  561.   StartTime() ;
  562.  
  563. (*  FOR j:=0 TO 500 DO*)
  564.  
  565.   WHILE (6 IN cia) DO
  566.    FOR i:=0 TO Objekte-1 DO
  567.      Restore(scr,source,bufadr[buf],aobj[i].w,aobj[i].h,aobj[i].xa[buf],aobj[i].ya[buf]) ;
  568.    END ;
  569.    FOR i:=0 TO Objekte-1 DO
  570.  
  571.      aobj[i].frm := (aobj[i].frm + aobj[i].as) MOD aobj[i].cnt ;
  572.  
  573.      CookieCut(scr,aobj[i].adr + ADDRESS(aobj[i].frm * (aobj[i].w * aobj[i].h)),
  574.                    bufadr[buf],aobj[i].w,aobj[i].h,aobj[i].x,aobj[i].y,0) ;
  575.  
  576.      aobj[i].xa[buf] := aobj[i].x ;
  577.      aobj[i].ya[buf] := aobj[i].y ;
  578.  
  579.      aobj[i].x := aobj[i].x + aobj[i].vx ;
  580.      IF (aobj[i].x<=0) OR (aobj[i].x>=scr^.width-aobj[i].w) THEN
  581.        aobj[i].vx := aobj[i].vx * (-1) ;
  582.        aobj[i].x  := aobj[i].x + aobj[i].vx ;
  583.      END ;
  584.      aobj[i].y := aobj[i].y + aobj[i].vy ;
  585.      IF (aobj[i].y<=0) OR (aobj[i].y>=SHIFT(scr^.height,-1)-aobj[i].h) THEN
  586.        aobj[i].vy := aobj[i].vy * (-1) ;
  587.        aobj[i].y  := aobj[i].y + aobj[i].vy ;
  588.      END ;
  589.  
  590.    END (*FOR i*) ;
  591.  
  592.    VillageSetDisplayBuf(scr,buf) ;
  593.    Swap(buf,buf1) ;
  594.  
  595.   END (*WHILE*) ;
  596.  
  597.   StopTime(time) ;
  598.   Permit() ;
  599.   Erg(time) ;
  600.  
  601.  
  602. CLOSE
  603.   IF scr#NIL THEN
  604.     UnLockVillageScreen(scr) ;
  605.     CloseVillageScreen(scr) ;
  606.   END ;
  607.   IF source#NIL THEN
  608.     FreeMem(source,Bildw*Bildh) ;
  609.   END ;
  610.   IF kugeln#NIL THEN
  611.     FreeMem(kugeln,16*16*15) ;
  612.   END ;
  613.   IF ufo#NIL THEN
  614.     FreeMem(ufo,32*33*8) ;
  615.   END ;
  616.   IF expl#NIL THEN
  617.     FreeMem(expl,16*16*4) ;
  618.   END ;
  619.  
  620. END Space.
  621.  
  622.